package com.example.safeassistan.widget;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.safeassistan.R;
import com.example.safeassistan.base.BaseBottomDialog;


/**
 *评分
 */
public class CommentScoreBottomDialog extends BaseBottomDialog {
    private ImageView ivClose;
    private ImageView  ivScore1,ivScore2,ivScore3,ivScore4,ivScore5,
            ivScore6, ivScore7,ivScore8,ivScore9,ivScore10;


    private ClickListenerInterface clickListenerInterface;

    public interface ClickListenerInterface {
        void selectScore(int score);
    }

    public CommentScoreBottomDialog() {
    }

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_comment_score;
    }

    @Override
    public void bindView(View v) {
        ivClose=v.findViewById(R.id.ivClose);
        ivClose.setOnClickListener(new clickListener());
        ivScore1=v.findViewById(R.id.ivScore1);
        ivScore2=v.findViewById(R.id.ivScore2);
        ivScore3=v.findViewById(R.id.ivScore3);
        ivScore4=v.findViewById(R.id.ivScore4);
        ivScore5=v.findViewById(R.id.ivScore5);
        ivScore6=v.findViewById(R.id.ivScore6);
        ivScore7=v.findViewById(R.id.ivScore7);
        ivScore8=v.findViewById(R.id.ivScore8);
        ivScore9=v.findViewById(R.id.ivScore9);
        ivScore10=v.findViewById(R.id.ivScore10);
        ivScore1.setOnClickListener(new clickListener());
        ivScore2.setOnClickListener(new clickListener());
        ivScore3.setOnClickListener(new clickListener());
        ivScore4.setOnClickListener(new clickListener());
        ivScore5.setOnClickListener(new clickListener());
        ivScore6.setOnClickListener(new clickListener());
        ivScore7.setOnClickListener(new clickListener());
        ivScore8.setOnClickListener(new clickListener());
        ivScore9.setOnClickListener(new clickListener());
        ivScore10.setOnClickListener(new clickListener());
    }

    public void setClicklistener(ClickListenerInterface clickListener) {
        clickListenerInterface = clickListener;
    }

    private class clickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.ivClose:
                    dismiss();
                    break;
                case R.id.ivScore1:
                    clickListenerInterface.selectScore(1);
                    break;
                case R.id.ivScore2:
                    clickListenerInterface.selectScore(2);
                    break;
                case R.id.ivScore3:
                    clickListenerInterface.selectScore(3);
                    break;
                case R.id.ivScore4:
                    clickListenerInterface.selectScore(4);
                    break;
                case R.id.ivScore5:
                    clickListenerInterface.selectScore(5);
                    break;
                case R.id.ivScore6:
                    clickListenerInterface.selectScore(6);
                    break;
                case R.id.ivScore7:
                    clickListenerInterface.selectScore(7);
                    break;
                case R.id.ivScore8:
                    clickListenerInterface.selectScore(8);
                    break;
                case R.id.ivScore9:
                    clickListenerInterface.selectScore(9);
                    break;
                case R.id.ivScore10:
                    clickListenerInterface.selectScore(10);
                    break;

                default:
                    break;
            }
        }
    }
}
